fix(init): detect and clean up orphaned .github/hooks/rtk-rewrite.json with broken hook command#837
Conversation
ef08df0 to
b712f13
Compare
|
Hey We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes No logic changes — only file moves and import path updates. What you need to doRebase your branch on git fetch origin && git rebase origin/developGit detects renames automatically. If you get import conflicts, update the paths: use crate::git; // now: use crate::cmds::git::git;
use crate::tracking; // now: use crate::core::tracking;
use crate::config; // now: use crate::core::config;
use crate::init; // now: use crate::hooks::init;
use crate::gain; // now: use crate::analytics::gain;Need help rebasing? Tag @aeppling |
Users who ran an earlier rtk init --copilot (from commit rtk-ai#605) ended up with .github/hooks/rtk-rewrite.json containing "command": "rtk hook" (missing subcommand). This causes RTK to log a spurious parse_failure on every Bash tool call, inflating rtk gain --failures stats silently. - rtk init --show: warns when the broken file is detected, with actionable guidance pointing to rtk gain --failures and the fix - rtk init -g --uninstall: removes the broken file as part of standard cleanup (only when command is the broken "rtk hook", leaves a correctly configured "rtk hook copilot" file untouched) Fixes rtk-ai#836
b712f13 to
3f9e822
Compare
|
Refactored to comply with the repository reorg. |
|
Hi @rolf-quadra — just wanted to flag that PR #728 (
If #728 gets merged first this PR may become redundant, but if yours lands first the orphaned-hook detection would be a nice complement. Either way, thanks for tackling #836 — it's the same root cause I ran into. |
Fixes #836
What
rtk init --show: warns when.github/hooks/rtk-rewrite.jsonexists with"command": "rtk hook"(missing subcommand), with actionable guidance pointing tortk gain --failuresand the fixrtk init -g --uninstall: removes the broken file as part of standard cleanup (only when the command is the broken"rtk hook"— a correctly configured"rtk hook copilot"file is left untouched)Why
Users who ran an earlier
rtk init --copilot(introduced in #605) got.github/hooks/rtk-rewrite.jsonwith"command": "rtk hook"(no subcommand). Sincertk hookrequiresgeminiorcopilot, it prints help and exits non-zero on every Bash tool call. RTK silently logs aparse_failurewithraw_command = "hook"andfallback_succeeded = 0inhistory.db, inflatingrtk gain --failuresstats with no visible error to the user.The pending Copilot integration (#823) correctly generates
"rtk hook copilot", but neitherrtk init --shownorrtk init --uninstallcheck.github/hooks/for these orphaned files.Changes
src/init.rsonly — 66 lines added, no deletions, no new dependencies.Test